﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TrendingReader
{
    public partial class FrmStoriesList : Form
    {
        private TrendingReaderEntities _entities;
        public FrmStoriesList()
        {
            InitializeComponent();
        }

        private void FrmStoriesList_Load(object sender, EventArgs e)
        {
            _entities = new TrendingReaderEntities();

            LoadStoriesList();
        }

        private void LoadStoriesList()
        {
            var list = _entities.Stories.OrderBy(s => s.Name).ToList();

            DgvStoriesList.AutoGenerateColumns = false;
            DgvStoriesList.DataSource = list;
        }
    }
}
